home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / gnulib / ghostscr / extend.doc < prev    next >
Encoding:
Text File  |  1990-12-31  |  13.6 KB  |  320 lines

  1.    Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.
  19.  
  20. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  21.  
  22. This file, extend.doc, describes the Ghostscript extensions to the
  23. PostScript language.
  24.  
  25. For an overview of Ghostscript and a list of the documentation files, see
  26. README.
  27.  
  28. The Ghostscript language bears a very strong resemblance to the PostScript
  29. (TM) language.  The current release of Ghostscript, unless otherwise
  30. noted, is intended to conform exactly to the definition of the PostScript
  31. language as presented in the April 1986 printing of the PostScript
  32. reference manual published by Addison-Wesley, augmented by the following
  33. extensions published by Adobe:
  34.  
  35.     - The CMYK color operator extensions;
  36.  
  37.     - The minor additions for version 25.0 of the Postscript language;
  38.  
  39.     - A few of the Display PostScript operators (indicated below).
  40.  
  41. The following summarizes features of the Ghostscript language that extend
  42. the PostScript language.  Note that some of the added operators are
  43. actually implemented as Ghostscript language procedures in the
  44. initialization file ghost.ps.
  45.  
  46. Aladdin Enterprises intends to extend Ghostscript over time to implement
  47. the facilities of Level 2 PostScript.  Facilities of Display PostScript or
  48. Level 2 PostScript are indicated with (D) or (2) below.
  49.  
  50. Miscellaneous
  51. -------------
  52.  
  53. \r and ^Z are counted as whitespace.
  54.  
  55. readhexstring can take either a file or a string as the source of
  56. characters.  In the latter case, it leaves the remainder of the string on
  57. the stack, just as for the token operator.
  58.  
  59. run can take either a string or a file as its argument.  In the former
  60. case, it uses findlibfile to open the file (searching directories as
  61. needed).  In the latter case, it just runs the file, closing it at the
  62. end, and trapping errors just as for the string case.
  63.  
  64. Mathematical operators
  65. ----------------------
  66.     <number> arccos <number>
  67.         Computes the arc cosine of a number between -1 and 1.
  68.     <number> arcsin <number>
  69.         Computes the arc sine of a number between -1 and 1.
  70.  
  71. Dictionary operators
  72. --------------------
  73.     <dict> <integer> setmaxlength -
  74.         Changes the capacity of a dictionary, preserving its
  75.           contents.  Causes a dictfull error if the requested
  76.           capacity is less than the current number of occupied
  77.           entries.
  78.  
  79. Relational operators
  80. --------------------
  81.     <number|string> <number|string> max <number|string>
  82.         Returns the larger of two numbers or strings.
  83.     <number|string> <number|string> min <number|string>
  84.         Returns the smaller of two numbers or strings.
  85.  
  86. File operators
  87. --------------
  88.     <state> <file> type1decryptfile <newFile>
  89.         Creates a pseudo-file for decrypting a file that contains
  90.           hex characters (as for readhexstring) that represent an
  91.           encrypted string.  The pseudo-file is only available for
  92.           reading.
  93. (D)    <string> deletefile -
  94.         Deletes the file with the given name.  If the operating
  95.           system will not delete the file, causes an ioerror.
  96.     <file> eexec -
  97.         Starts reading and interpreting the indicated file in the
  98.           manner of the exec operator, but treats the contents of
  99.           the file as hex characters (as for readhexstring) and
  100.           applies eexec decryption to the data (type 1 decryption
  101.           with a seed of 55665).
  102.         eexec works by creating a pseudo-file, which then
  103.           becomes the current file.  When the pseudo-file is
  104.           closed, this is treated as the end of the encrypted
  105.           section, and the interpreter resumes reading from its
  106.           previous input, just as for exec.
  107.         eexec may read as many as 512 characters beyond the end of
  108.           the encrypted section, so a technique like the following
  109.           is advisable:
  110.             mark
  111.             currentfile eexec
  112.             ... encrypted section ...
  113.             000...000        ... 512 0's ...
  114.             cleartomark
  115.         The cleartomark removes any 0s that have been pushed on
  116.           the stack.
  117.     <file> filename <string>
  118.         Returns the name of the file.  Note that for files opened
  119.           by findlibfile, this is the name of the file that was
  120.           finally opened, which may be different from the name
  121.           originally supplied.
  122. (D)    <file> fileposition <integer>
  123.         Returns the current position within the file.  If the
  124.           notion of position is not meaningful for this file,
  125.           causes an ioerror error.
  126.     <string> findlibfile <file> true or <string> false
  127.         Opens the file of the given name for reading.  If the file
  128.           cannot be opened using the supplied name, searches
  129.           through directories as described in interp.doc.  If the
  130.           search fails, findlibfile simply pushes false on the
  131.           stack and returns, rather than causing an error.
  132. (D)    <string1> <string2> renamefile -
  133.         Renames the file named string1 to have the name string2.
  134.           If the operating system will not rename the file,
  135.           causes an ioerror.
  136. (D)    <file> <integer> setfileposition -
  137.         Sets the current position within the file.  If the notion
  138.           of position is not meaningful for this file, or if the
  139.           file is only open for writing, causes an ioerror error.
  140.           If the position is negative or beyond the end of the
  141.           file, causes a rangecheck error.
  142.     <file> <integer> unread -
  143.          Pushes back the given character onto the front of the
  144.           file.  If the file is only open for writing, or if the
  145.           C library call (ungetc) fails, causes an ioerror error.
  146.           If the integer is not in the range [0..255], causes
  147.           a rangecheck error.
  148.     <file> <device> writeppmfile -
  149.         Writes the contents of the device, which must be an image
  150.           device, onto the file, in Portable PixMap (ppm) format.
  151.           Does not close the file.
  152.  
  153. Miscellaneous operators
  154. -----------------------
  155.     - currenttime <number>
  156.         Returns the current value of a continuously-running timer,
  157.           in minutes.  The initial value of this timer is undefined.
  158.     <string> getenv   <string> true  or  false
  159.         Looks up a name in the shell environment.  If the name is
  160.           found, returns the corresponding value and true; if the
  161.           name is not found, returns false.
  162.     <string> <boolean> setdebug -
  163.         If the Ghostscript interpreter was built with the DEBUG
  164.           flag set, sets or resets any subset of the debugging
  165.           flags normally controlled by -Z in the command line.
  166.           Has no effect otherwise.
  167.     <state> <fromString> <toString> type1encrypt <newState> <toSubstring>
  168.         Encrypts fromString according to the algorithm for Adobe
  169.           Type 1 fonts, writing the result into toString.
  170.           toString must be at least as long as fromString or a
  171.           rangecheck error occurs.  state is the initial state of
  172.           the encryption algorithm (a 16-bit non-negative
  173.           integer); newState is the new state of the algorithm.
  174.     <state> <fromString> <toString> type1decrypt <newState> <toSubstring>
  175.         Decrypts fromString according to the algorithm for Adobe
  176.           Type 1 fonts, writing the result into toString.  Other
  177.           specifications are as for type1encrypt.
  178.  
  179. Graphics state operators
  180. ------------------------
  181.     - currentcolor <color>
  182.         Returns a color object (a new kind of object) representing
  183.           the current color/gray from the graphics state.
  184.     <color> setcolor -
  185.         Sets the current color in the graphics state according to
  186.           a color object.
  187.  
  188. Color operators
  189. ---------------
  190.     <h> <s> <b> hsbcolor <color>
  191.         Constructs a color object from hue, saturation, and
  192.           brightness values.
  193.     <r> <g> <b> rgbcolor <color>
  194.         Constructs a color object from red, green, and blue values.
  195.     <color> colorhsb <h> <s> <b>
  196.         Inverts the action of hsbcolor.
  197.     <color> colorrgb <r> <g> <b>
  198.         Inverts the action of rgbcolor.
  199.  
  200. Painting operators
  201. ------------------
  202. (D)    <x1> <y1> <x2> <y2> <r> arct -
  203.         Performs the same function as arcto, but does not
  204.         push the tangent points on the stack.
  205.  
  206. Device operators
  207. ----------------
  208.     <index> getdevice <device>
  209.         Returns a device from the set of devices known to the
  210.           system.  The first device, which is default, is numbered
  211.           0.  If the index is out of range, causes a rangecheck
  212.           error.
  213.     <device> devicename <string>
  214.         Gets the name of a device.  The devices currently
  215.           supported are listed in gdevs.mak.
  216.     <matrix> <width> <height> <palette> makeimagedevice <device>
  217.         Makes a new device that accumulates an image in memory.
  218.           palette is an array of color objects that specify how
  219.           the pixel values will be interpreted, e.g., if you want
  220.           a monochrome image for which 0=white and 1=black, the
  221.           palette should be the result of executing
  222.             [ 1 1 1 rgbcolor 0 0 0 rgbcolor ]
  223.           The palette must contain exactly 2, 4, 16, or 256
  224.           entries, and must contain an entry for black and an
  225.           entry for white; aside from this, its contents are
  226.           arbitrary.  Each pixel occupies log2(colormap size)
  227.           bits.
  228.         Alternatively, palette can be null.  This is interpreted
  229.           as 32-bit-per-pixel color, where the four bytes of each
  230.           pixel are respectively unused, R, G, and B.
  231.         Note that one can also make an image device (with the same
  232.           colormap as an existing image device) using makedevice.
  233.         ****** NOTE: the current implementation of makeimagedevice
  234.           only supports 1-, 8-, and 32-bit-per-pixel devices. ******
  235.     <device> <index> <string> copyscanlines <substring>
  236.         Copies one or more scan lines from an image device into a
  237.           string, starting at a given scan line in the image.
  238.           The data is in the same format as for the image
  239.           operator.  Error if the device is not an image device or
  240.           if the string is too small to hold at least one complete
  241.           scan line.  Always copies an integral number of scan
  242.           lines.
  243.     <device> <matrix> <width> <height> makedevice <device>
  244.         Makes a new device just like an existing one, but with a
  245.           specified width, height, and initial transformation.
  246.           Note that the width is in pixels, not in bytes as in
  247.           framedevice.
  248.     <device> setdevice -
  249.         Sets the current device to the specified device.  Also
  250.           resets the transformation and clipping path to the
  251.           initial values for the device.
  252.     - currentdevice <device>
  253.         Gets the current device from the graphics state.
  254.     <device> <matrix> deviceparams <<mark>> <matrix> <width> <height>
  255.         Gets the parameters of a device.  Some devices may have
  256.           additional parameters betwen the mark and the matrix:
  257.           one should use cleartomark to remove the output of
  258.           deviceparams from the stack.
  259.     - flushpage -
  260.         On displays, flushes any buffered output, so that it
  261.           is guaranteed to show up on the screen; on printers,
  262.           has no effect.
  263.  
  264. Character operators
  265. -------------------
  266.     <string> type1addpath -
  267.         Adds the description of a character to the current path,
  268.           and then optionally render the character.  The string
  269.           argument is a scalable description encoded in Adobe Type
  270.           1 format.  This operator is only valid in the context of
  271.           a show operator, like setcharwidth and setcachedevice.
  272.           It uses information from the current font, in addition
  273.           to the argument.
  274.     <image> <width> <height> <wx> <wy> <ox> <oy> <string>
  275.       type1imagepath <substring>
  276.         Converts an image (bitmap) description of a character into
  277.           a scalable description in Adobe Type 1 format.  The
  278.           current transformation matrix should be the same as the
  279.           FontMatrix of the font in which this character will be
  280.           used: this establishes the scaling relationship between
  281.           image pixels (the image is assumed to be 1 unit high in
  282.           user space) and the character coordinate system used in
  283.           the scalable description.  wx and wy are the character
  284.           width, and ox and oy are the character origin relative
  285.           to the lower left corner of the bitmap, in *pixels*.
  286.         All coordinates in the scalable description are rounded to
  287.           integers, so the coefficients in the FontMatrix should
  288.           be on the order of 1/N for some value of N that is
  289.           either a multiple of the height/width or is large
  290.           compared to the width and height.  (There is a
  291.           convention, which some P*stScr*pt programs rely on, that
  292.           N=1000.)
  293.         Note that the encoded description has *not* been subjected
  294.           to CharString encryption, which is necessary before the
  295.           description can be given to type1addpath: to do this,
  296.           follow the type1imagepath with
  297.             4330 exch dup type1encrypt exch pop
  298.         If the description is too complex to fit into the supplied
  299.           string, a limitcheck error results.  A good rule of
  300.           thumb is that the size of the string should be about 6
  301.           times the number of 1-bits in the image that are not
  302.           completely surrounded by other 1-bits.
  303.     <font> <char> Type1BuildChar -
  304.         This is not a new operator: rather, it is a name known
  305.           specially to the interpreter.  Whenever the interpreter
  306.           needs to render a character (during a ...show,
  307.           stringwidth, or charpath), it looks up the name
  308.           BuildChar in the font dictionary to find a procedure to
  309.           run.  If it does not find this name, and if the FontType
  310.           is 1, the interpreter instead uses the value (looked up
  311.           on the dictionary stack in the usual way) of the name
  312.           Type1BuildChar.
  313.         The standard definition of Type1BuildChar is in gfonts.ps.
  314.           Users should not need to redefine Type1BuildChar, except
  315.           perhaps for tracing or debugging.
  316.  
  317. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  318.  
  319. PostScript is a trademark of Adobe Systems, Incorporated.
  320.